<template>
	<div class="newsinfo-container">
		<h3 class="title">{{list.title}}</h3>
		<p class="subtitle">
			<span>发表时间 : {{list.add_time|dateFormat}}</span>
		    <span>点击次数 : {{list.click}}次</span>
		</p>
		<hr />
		<div class="content" v-html="list.content"></div>
		<hr />
		<comment-box :id="this.id"></comment-box>
	</div>
</template>

<script>
	//	导入comment 评论组件
	import comment from '../subComponents/comment.vue'
	export default{
		data(){
			return{
				id:this.$route.params.id,
				list:{}
			}
		},
		created(){
			this.getNewInfo()
		},
		methods:{
			getNewInfo(){
				this.$http.get('api/getnew/'+this.id).then(res=>{
					console.log(res.body.message[0]);
					this.list=res.body.message[0]
				})
			}
		},
		components:{
			'comment-box':comment
		}
	}
</script>

<style scoped>
	.newsinfo-container{
		padding: 0 5px;
	}
	.newsinfo-container .title{
		text-align: center;
		font-size: 16px;
		margin: 15px 0;
	}
	.newsinfo-container .subtitle{
		display: flex;
		justify-content: space-between;
		font-size: 12px;
		color: #26A2FF;
	}
</style>
